﻿<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1">
    <!-- Google Chrome Frame也可以让IE用上Chrome的引擎: -->
    <meta name="renderer" content="webkit">
    <!--国产浏览器高速模式-->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="author" content="1024招聘" />
    <!-- 作者 -->
    <meta name="revised" content="1024招聘" />
    <!-- 定义页面的最新版本 -->
    <meta name="description" content="网站简介" />
    <!-- 网站简介 -->
    <meta name="keywords" content="搜索关键字，以半角英文逗号隔开" />
    <title>1024招聘</title>

    <!-- 公共样式 开始 -->
    <link rel="stylesheet" type="text/css" href="../../css/base.css">
    <link rel="stylesheet" type="text/css" href="../../fonts/iconfont.css">
    <script type="text/javascript" src="../../framework/jquery-1.11.3.min.js"></script>
    <link rel="stylesheet" type="text/css" href="../../layui/css/layui.css">
    <script type="text/javascript" src="../../layui/layui.js"></script>
    <script src="../../framework/cframe.js"></script>
    <link href="~/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
    <script src="~/lib/jquery/jquery-1.9.0.min.js" type="text/javascript"></script>
    <script src="~/lib/ligerUI/js/core/base.js" type="text/javascript"></script>
    <script src="~/lib/ligerUI/js/plugins/ligerDrag.js" type="text/javascript"></script>
    <script src="~/lib/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
    <script src="~/lib/ligerUI/js/plugins/ligerComboBox.js" type="text/javascript"></script>
    <script src="~/lib/ligerUI/js/plugins/ligerDateEditor.js" type="text/javascript"></script>
    <!-- 仅供所有子页面使用 -->
    <!-- 公共样式 结束 -->

    <script src="../../js/out_intoData.js"></script>

</head>

<body>
    <div class="cBody">
        <form class="layui-form" action="">
            <div class="layui-form-item">
                <div class="layui-input-inline">
                    <input type="text" id="Industryname" placeholder="输入用户名称" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-btn btn_Industryname" id="but_Industryname" lay-submit lay-filter="submitBut">检索</div>
            </div>
        </form>
        <div class="layui-tab" lay-filter="myPage">
            <ul class="layui-tab-title">
                <li class="layui-this" lay-id="whitelist">公司信息列表</li>
                <li lay-id="blackList">黑名单列表</li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <table id="test" class="table table-striped table-bordered table-hover layui-hide" lay-filter="test"></table>
                    <!-- layUI 分页模块 -->
                    <div id="pages1"></div>
                    @*<script>
                        layui.use(['laypage', 'layer'], function () {
                            var laypage = layui.laypage,
                                layer = layui.layer;

                            //总页数大于页码总数
                            laypage.render({
                                elem: 'pages1',
                                count: 30,
                                layout: ['prev', 'page', 'next', 'limit', 'skip'],
                                jump: function (obj) {
                                    console.log(obj)
                                }
                            });
                        });
                    </script>*@
                </div>
                <div class="layui-tab-item">
                    <table id="tests" class="table table-striped table-bordered table-hover layui-hide" lay-filter="tests">@*黑名单*@</table>
                    <div id="target1" style="width:500px; margin:3px; display:none;">
                        <div class="layui-form-item">
                            <label class="layui-form-label">公司名</label>
                            <div class="layui-input-inline shortInput">
                                <input type="text" id="ComFullName" name="loginName" value="" readonly required autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">人数</label>
                            <div class="layui-input-inline shortInput">
                                <input type="text" id="ComScale" name="loginName" value="" readonly required autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">手机号码</label>
                            <div class="layui-input-inline shortInput">
                                <input type="text" id="CompanyPhone" name="loginName" value="" readonly required autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">邮箱</label>
                            <div class="layui-input-inline shortInput">
                                <input type="text" id="CompanyEmail" name="loginName" value="" readonly required autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">QQ</label>
                            <div class="layui-input-inline shortInput">
                                <input type="text" id="ComForShort" name="loginName" value="" readonly required autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">微博</label>
                            <div class="layui-input-inline shortInput">
                                <input type="text" id="ComWebsite" name="loginName" value="" readonly required autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">经验</label>
                            <div class="layui-input-inline shortInput">
                                <input type="text" id="WorkExperiens" name="loginName" readonly value="" required autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">头像</label>
                            <div class="layui-input-inline shortInput">
                                <img src="~/images/goodsPIC4.png" id="imags" style="width:80px;height:80px;">
                            </div>
                        </div>
                    </div>
                    <!-- layUI 分页模块 -->
                    <div id="pages2"></div>
                    @*<script>
                                layui.use(['laypage', 'layer'], function() {
                                    var laypage = layui.laypage,
                                        layer = layui.layer;

                                    //总页数大于页码总数
                                    laypage.render({
                                        elem: 'pages2',
                                        count: 100,
                                        layout: ['prev', 'page', 'next', 'limit', 'skip'],
                                        jump: function(obj) {
                                            console.log(obj)
                                        }
                                    });
                                });
                        </script>*@
                </div>
            </div>
        </div>
        <script>
            layui.use('element', function () {
                var element = layui.element;

                //获取hash来切换选项卡，假设当前地址的hash为lay-id对应的值
                var layid = location.hash.replace(/^#list=/, '');
                element.tabChange('myPage', layid); //假设当前地址为：http://a.com#test1=222，那么选项卡会自动切换到“发送消息”这一项

                //监听Tab切换，以改变地址hash值
                element.on('tab(myPage)', function () {
                    location.hash = 'list=' + this.getAttribute('lay-id');
                    console.log(this.getAttribute('lay-id'));
                });
            });
        </script>
    </div>
</body>

</html>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-xs" lay-event="edit">查看</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script type="text/javascript">
    layui.use('table', function () {
        var form = layui.form,
            table = layui.table;
        table.render({
            elem: '#test'
            , url: '/Client/QueryCompanyList'
            , page: true
            //, cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增0:少于15人  1:15-50人  2:50-150人  3:150-500人  4:500-2000人  5:2000人以上'
            , cols: [[                
                 { field: 'ComFullName', width: 240, title: '公司名' }
                , {
                    field: 'ComScale', width: 120, title: '人数', templet: function (d) {
                        if (d.ComScale == 0) { return "少于15人" } else if (d.ComScale == 1) { return "15-50人" } else if (d.ComScale == 2) { return "50-150人" } else if (d.ComScale == 3) { return "500-2000人" } return "2000人以上"
                    }
                }
                , { field: 'CompanyPhone', width: 180, title: '手机号码' }
                , { field: 'CompanyEmail', width: 200, title: '邮箱' }
                , { title: '操作', fixed: 'right', width: 200, align: 'center', toolbar: '#barDemo' }
            ]]
        });
        $(".btn_Industryname").click(function () {
            var ComFullName = $("#Industryname").val();
            table.reload('test', {
                where: {
                    ComFullName: ComFullName
                }
            });
        });

        table.on('tool(test)', function (obj) {
            //注：tool 是工具条事件名，test 是 table 原始容器的属性 lay-filter="对应的值"
            var data = obj.data //获得当前行数据
                , layEvent = obj.event; //获得 lay-event 对应的值
            if (layEvent === 'detail') {

            } else if (layEvent === 'del') {
                layer.confirm('真的删除行么', function (index) {
                    del(data.CompId);
                    obj.del(); //删除对应行（tr）的DOM结构
                    layer.close(index);
                    //向服务端发送删除指令
                });
            } else if (layEvent === 'edit') {
                $(function () {
                    $("#loginName").val(data.UserName);
                    $("#name_zheng").val(data.RealName);
                    $("#phones").val(data.Phone);
                    $("#Email").val(data.Email);
                    $("#qq").val(data.QQ);
                    $("#weibo").val(data.SinaMicroblog);
                    $("#WorkExperiens").val(data.WorkExperien + "年");
                    $("#imags").attr("src", "http://www.bdqnt1818203.work"+data.TouXiang);
                    $.ligerDialog.open({
                        title: "用户信息", width: 600, height: 400, target: $("#target1"), isResize: true
                    });
                });
            }
        });

        //删除
        function del(id) {
            var data = {};
            data.UserId = id;
            $.ajax({
                type: "post",
                url: "/Client/DeleteCompany",
                data: data,
                success: function (json) {
                    location.reload();
                    if (json.Success) {
                        layer.alert('删除成功！', {
                            title: '提示框',
                            icon: 1,
                        }, function () {
                            location.href = "/Client/FirmManager";
                        });
                    } else {
                        layer.alert('删除失败！', {
                            title: '提示框',
                            icon: 0,
                        });
                        layer.close(MenuSection);
                    }
                }
            });
        }

    });
    layui.use('table', function () {
        var form = layui.form,
            table = layui.table;
        var Types = true;
        table.render({
            elem: '#tests'
            , url: '/Client/BlacklistBaseShow?Types=' + Types
            , page: true
            //, cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
            , cols: [[
                { field: 'Id', width: 100, title: '编号', sort: true }
                , { field: 'UserName', width: 190, title: '用户名' }
                , { field: 'ComFullName', width: 190, title: '公司全称' }
            ]]
        });
    });
</script>